package com.majiang.majiang.domain;

import lombok.Getter;
import lombok.Setter;

/**
 *
 * @author Administrator
 * 字牌的bean：包含  万、条、筒
 *                  1  2  3
 */
@Getter
@Setter
public class MaJiangNumber extends MaJiang implements Comparable<MaJiangNumber>{
    /**
     * 数字：1~9
     */
    private int number;

    @Override
    public String toString() {
        StringBuilder maJiangNumberStr = new StringBuilder();
        maJiangNumberStr.append("[");
        maJiangNumberStr.append(this.getNumber());
        switch (this.getType()) {
            case 1:
                maJiangNumberStr.append("万");
                break;
            case 2:
                maJiangNumberStr.append("条");
                break;
            case 3:
                maJiangNumberStr.append("筒");
                break;
        }
        maJiangNumberStr.append("]");
        return maJiangNumberStr.toString();
    }

    @Override
    public int compareTo(MaJiangNumber o) {
        return this.getNumber() - o.getNumber();
    }

    @Override
    public boolean equals(Object obj) {
        return super.getType() == ((MaJiang)obj).getType() && this.number == ((MaJiangNumber) obj).number;
    }
}
